1 using UnityEngine;
2 using
System.Collections;
3
4 public
class InterpolationExp : InterpolationProcess {
5
6     
protected float value, power, min, scale;
7
8     
public InterpolationExp(float value, float power)
9     {
10         
this.value = value;
11         
this.power = power;
12         min = Mathf.Pow(
value, -power);
13         scale =
1 / (1 - min);
14     }
15
16     
public override float apply(float a)
17     {
18         
if (a <= 0.5f) return (Mathf.Pow(value, power * (a * 2 - 1) - min)) * scale / 2;
19         
return (2 - (Mathf.Pow(value, -power * (a * 2 - 1)) - min) * scale)/2;
20     }
21 }



Trò chơi đua xe động vật trong UNITY Engine 114.897 lượt xem

Gõ tìm kiếm nhanh...